part of '../index.dart';

extension ExWidget on Widget {
  Widget get expanded => Expanded(child: this);
  Widget get sliver => SliverToBoxAdapter(child: this);
  Widget clipRRect(
    double? radius, {
    Key? key,
    double? topLeft,
    double? topRight,
    double? bottomLeft,
    double? bottomRight,
    CustomClipper<RRect>? clipper,
    Clip clipBehavior = Clip.antiAlias,
  }) =>
      ClipRRect(
        key: key,
        clipper: clipper,
        clipBehavior: clipBehavior,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(topLeft ?? radius ?? 0.0),
          topRight: Radius.circular(topRight ?? radius ?? 0.0),
          bottomLeft: Radius.circular(bottomLeft ?? radius ?? 0.0),
          bottomRight: Radius.circular(bottomRight ?? radius ?? 0.0),
        ),
        child: this,
      );
  Widget onTap(
    GestureTapCallback? onTap, {
    Key? key,
    HitTestBehavior? behavior,
    bool excludeFromSemantics = false,
    DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  }) =>
      GestureDetector(
        key: key,
        onTap: onTap,
        behavior: behavior ?? HitTestBehavior.opaque,
        excludeFromSemantics: excludeFromSemantics,
        dragStartBehavior: dragStartBehavior,
        child: this,
      );
}
